
import subprocess
from app.core.conf import ST

def login_by_powershell(loginid:str):
    try:
        args=[r"powershell",ST.shell_getuserinfo_path,loginid] #args参数里的ip是对应调用powershell里的动态参数args[0],类似python中的sys.argv[1]
        p=subprocess.Popen(args, stdout=subprocess.PIPE)
        dt=p.stdout.read()
        return eval(str(dt, encoding = "utf-8"))
    except Exception as e:
        print (e)
        return False